/*
 * @Author: Luo jiaxing
 * @Date: 2017-05-22 14:27:12
 * @Last Modified by: cgd
 * @Last Modified time: 2017-10-31 11:18:07
 * 新建方案
 */
Ext.define('Admin.view.solutionManage.newSolutions.Xun', {
    extend: 'Ext.panel.Panel',
    xtype: 'baseXunSolutionInfo',
    requires: ['Admin.view.solutionManage.NewSolutionController'],
    controller: 'newSolutionController',
    margin: 3,
    layout: {
        type: 'vbox',
        align: 'stretch'
    },
    items: [{
        height: 190,
        xtype: 'baseFormPanel',
        cls: 'shadow new-solution-form',
        border: false,
        style: 'border: 1px solid #ccc',
        margin: '20 0 0 0',
        columns: 4,
        defLabelWidth: 90,
        defMaxWidth: 250,
        minWidth: 150,
        items: [{
            xtype: 'textfield',
            fieldLabel: '方案名称',
            allowBlank: false,
            reference: 'proNm',
            value: '方案名称',
            blankText: "请填写方案名称"
        }, {
            xtype: 'textfield',
            fieldLabel: '方案类型',
            value: '旬调度',
            readOnly: true
        }, {
            xtype: "combo",
            fieldLabel: "对应年调度方案",
            labelWidth: 100,
            valueField: 'value', //值字段
            displayField: 'text', //显示字段
            emptyText: '请选择', //提示信息
            reference: 'dpplCd',
            store: {
                fields: ['value', 'text'],
                proxy: {
                    type: 'ajax',
                    url: '/jsite-szy-dispatch/a/szy/dispatch/ddsRdP/listAllSolutionsByProTp',
                    extraParams: {
                        river: config.RIVER,
                        proTp: '1'
                    },
                    reader: {
                        root: 'list',
                        totalProperty: 'count'
                    }
                },
                autoLoad: true
            }
        }, {
            xtype: 'datetimefield',
            fieldLabel: '方案起始时间',
            emptyText: '请选择',
            allowBlank: false,
            blankText: "请选择开始时间",
            reference: 'bgDt',
            value: '2017-01-01',
            listeners: {
                change: function() {
                    var edDt = this.nextSibling();
                    edDt.setMinValue(this.value)
                }
            }
        }, {
            xtype: 'datetimefield',
            fieldLabel: '方案终止时间',
            emptyText: '请选择',
            blankText: "请选择结束时间",
            allowBlank: false,
            reference: 'edDt',
            value: '2017-04-01'
        }, {
            xtype: 'textfield',
            fieldLabel: '时段类型',
            value: '旬',
            readOnly: true
        }, {
            xtype: 'textfield',
            fieldLabel: '专题信息',
            value: (config.RIVER === '02' ? '抚河流域' : (config.RIVER === '03' ? '袁河流域' : '')) + '水资源调度',
            readOnly: true
        }, {
            xtype: 'textfield',
            fieldLabel: '制作人',
            allowBlank: false,
            reference: 'producer',
            value: '用户A',
            blankText: "请填写制作人"
        }, {
            xtype: 'textfield',
            fieldLabel: '方案描述',
            reference: 'nt'
        }, {
            xtype: "combo",
            fieldLabel: '基准年',
            reference: 'byr',
            valueField: 'value',
            displayField: 'text',
            value: '2015',
            emptyText: '请选择',
            editable: false,
            store: {
                fields: ['value', 'text'],
                data: [
                    ['2015', '2015']
                ]
            }
        }],
        tbar: ['->', {
            xtype: 'button',
            iconCls: 'x-fa fa-save',
            text: '新建方案',
            handler: 'toXunSolution'
        }]
    }, {
        flex: 1,
        margin: "10 0 0 0",
        bodyStyle: 'background-color: #F6F6F6',
        // html: '<div style="width: 100%;height: 100%;margin: auto; ' +
        // 'background:url(\'' + $.dispatch.imgPath('ght2.jpg') + '\') no-repeat;background-size:100% 100%;"></div>',
        listeners: {
            // resize: 'showGHT'
        }
    }]
});